﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddService.ascx.cs"
    Inherits="Hotel.UserControls.AddService" %>
<div>
	<table>
		<tr>
			<td>
				&nbsp;
			</td>
			<td>
				<asp:GridView ID="gvServices" runat="server" CellPadding="0" CellSpacing="0" HeaderStyle-BackColor="#EAEAEA"
					AutoGenerateColumns="false" CssClass="grid" AlternatingRowStyle-CssClass="gridAltRow"
					RowStyle-CssClass="gridRow" ShowFooter="True" EditRowStyle-CssClass="gridEditRow"
					FooterStyle-CssClass="gridFooterRow" OnRowCancelingEdit="gvServices_RowCancelingEdit"
					OnRowCommand="gvServices_RowCommand" OnRowDeleting="gvServices_RowDeleting" OnRowUpdating="gvServices_RowUpdating"
					DataKeyNames="ServiceId" OnRowEditing="gvServices_RowEditing" >
					<Columns>
						<asp:TemplateField HeaderText="Service Name" HeaderStyle-HorizontalAlign="Left">
							<ItemTemplate>
								<asp:Label ID="lblName" runat="server" Text='<%# Eval("ServiceName") %>' Width="250"></asp:Label>
							</ItemTemplate>
							<EditItemTemplate>
								<asp:TextBox ID="txtName" runat="server" Text='<%# Bind("ServiceName") %>' CssClass="textbox"
									Width="250"></asp:TextBox>
<asp:RequiredFieldValidator ID="txtNameRq" runat="server" ErrorMessage="Service Name is Required" SetFocusOnError="true"    ControlToValidate="txtName" ValidationGroup="Update" Display="None"></asp:RequiredFieldValidator>
							</EditItemTemplate>
							<FooterTemplate>
								<asp:TextBox ID="txtNameNew" runat="server" CssClass="textbox" Width="250"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="txtNameIRq" runat="server" ErrorMessage="Service Name is Required" SetFocusOnError="true"    ControlToValidate="txtNameNew" ValidationGroup="Insert" Display="None"></asp:RequiredFieldValidator>
							</FooterTemplate>
						</asp:TemplateField>
						<asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
							<EditItemTemplate>
								<asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" CommandName="Update"
									Text="Update" OnClientClick="return confirm('Update?')" ValidationGroup="Update"></asp:LinkButton>
								<asp:ValidationSummary ID="vsUpdate" runat="server" ShowMessageBox="true" ShowSummary="false"
									ValidationGroup="Update" Enabled="true" HeaderText="" />
								<asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
									Text="Cancel"></asp:LinkButton>
							</EditItemTemplate>
							<FooterTemplate>
								<asp:LinkButton ID="lnkAdd" runat="server" CausesValidation="True" CommandName="Insert"
									ValidationGroup="Insert" Text="Add"></asp:LinkButton>
								<asp:ValidationSummary ID="vsInsert" runat="server" ShowMessageBox="true" ShowSummary="false"
									ValidationGroup="Insert" Enabled="true" HeaderText="" />
							</FooterTemplate>
							<ItemTemplate>
								<asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit"
									Text="Edit"></asp:LinkButton>
							</ItemTemplate>
							<HeaderStyle HorizontalAlign="Left" />
						</asp:TemplateField>
						<asp:TemplateField HeaderText="Delete" ShowHeader="False" HeaderStyle-HorizontalAlign="Left" Visible="false">
							<ItemTemplate>
								<asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="False" CommandName="Delete"
									Text="Delete" OnClientClick="return confirm('Delete?')"></asp:LinkButton>
							</ItemTemplate>
							<HeaderStyle HorizontalAlign="Left" />
						</asp:TemplateField>
					</Columns>
					<EmptyDataTemplate>
						<table class="grid" cellspacing="0" rules="all" border="1" id="gvServices" style="border-collapse: collapse;">
							<tr>
								<th align="left" scope="col">
									Service Name
								</th>
								<th align="left" scope="col">
									Edit
								</th>
								<th scope="col">
									Delete
								</th>
							</tr>
							<tr class="gridRow">
								<td colspan="3">
									No Records found...
								</td>
							</tr>
					</EmptyDataTemplate>
				</asp:GridView>
			</td>
		</tr>
	</table>
</div>
